package com.hrm.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hrm.entity.RoomRepair;
import com.hrm.vo.RoomRepairVO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

public interface RoomRepairMapper extends BaseMapper<RoomRepair> {


    @Select("select arr.*,atr.room_name from att_room_repair arr " +
            "inner join att_room atr on atr.id = arr.room_id " +
            "where arr.is_deleted = 0 and arr.staff_id = #{id}")
    IPage<RoomRepairVO> listRoomRepairVOByStaffId(IPage<RoomRepairVO> config, @Param("id") Integer id);

    /**
     * 不显示撤销的报修
     *
     * @param config
     * @param name
     * @return
     */
    @Select("select arr.*,ss.name,ss.code,ss.phone,atr.room_name from att_room_repair arr " +
            "inner join sys_staff ss on ss.id = arr.staff_id " +
            "inner join att_room atr on atr.id = arr.room_id " +
            "where arr.is_deleted = 0 and arr.status != 3 and ss.name like concat('%',#{name},'%')")
    IPage<RoomRepairVO> listRoomRepairVO(IPage<RoomRepairVO> config, @Param("name") String name);

}
